package com.fufu.ai.ai.entity.vo;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.MessageType;

@Data
@NoArgsConstructor
public class MessageVo {

    private String role;

    private String content;

    public MessageVo(Message message) {
        MessageType messageType = message.getMessageType();
        switch (messageType) {
            case USER -> role = "user";
            case ASSISTANT -> role = "assistant";
        }
        this.content = message.getText();
    }
}
